package com.nerve.secondhandcar.service.impl;

import org.ko.core.dao.support.Finder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import com.nerve.secondhandcar.controller.model.ResaleApplyModel;
import com.nerve.secondhandcar.dao.ResaleApplyDao;
import com.nerve.secondhandcar.domain.ResaleApply;
import com.nerve.secondhandcar.service.ResaleApplyService;

/**
 * @project: secondHandCarPlatform
 * @file: ResaleApplyServiceImpl.java
 * @package: com.nerve.secondhandcar.service.impl
 * @description:
 *
 * @author: 集成显卡	1053214511@qq.com
				IBM GDC, zengxm@cn.ibm.com
 * @date&time: 2014-10-24
 * @change log:
 */
@Service
public class ResaleApplyServiceImpl implements ResaleApplyService{

	@Autowired
	private ResaleApplyDao dao;
	
	@Override
	public void delete(Long[] ids) throws Exception {
		dao.delete(ids);
	}

	@Override
	public void list(ResaleApplyModel model) throws Exception {
		StringBuilder sb = new StringBuilder("FROM ResaleApply where category="+model.getCategory());	
		Finder f = Finder.create(sb.toString());
		f.append(" order by id desc");
		dao.find(f, model);
		
	}
	/**
	 * 浏览详情
	 * @param model
	 * @throws Exception
	 */
	public void view(ResaleApplyModel model)throws Exception{
		ResaleApply entity = dao.get(model.getId());
		Assert.notNull(entity, "你查看的对象不存在");
		
		model.setBean(entity);
	}
	

}